The present invention generally relates to bar code demodulating methods and, more particularly, to a bar code demodulating method which can accurately read a bar code even if the printing quality of the bar code is poor, if the widths of the bars are non-uniform due to curved labels, or the like.
The use of bar codes is becoming very popular, as typified by the use of bar codes at point-of-sale (POS) terminals of circulation systems. On the other hand, there is an increasing number of bar codes having a poor printing quality, and there are demands to correctly read the bar codes regardless of their printing quality.
For example, the poor printing quality introduces the defect that the black bar of the bar code may increase or decrease in width. FIG. 1 (A) shows the respective widths of white and black bars of the bar code when the bars are correctly printed. FIG. 1 (B) shows a case where the width of the black bar is increased by a part P.sub.0 due to the poor printing quality, and FIG. 1 (C) shows a case where the width of the black bar is decreased by a part P.sub.1 due to the poor printing quality.
A length T1 of two successive parts B1 and B2, that is, the white level part B1 and the black level part B2 in FIG. 1 (B), is equal to the length T1 of the two successive white and black level parts B1 and B2 in FIG. 1 (A). Similarly, a length T2 of two successive parts B2 and B3, that is, the black level part B2 and the white level part B3 in FIG. 1 (B), is equal to the length T2 of the two successive black and white level parts B2 and B3 in FIG. 1 (A). Furthermore, lengths T1 and T2 shown in FIG. 1 (C) are respectively equal to the lengths T1 and T2 shown in FIG. 1 (A). These lengths T1 and T2 are sometimes referred to as .delta.-distances. By use of these .delta.-distances T1 and T2, it is possible to eliminate the undesirable effects of uniformly increased and decreased widths of the black bars. For this reason, the .delta.-distances T1 and T2 are used when demodulating the read bar code.
When discriminating the bar code using the .delta.-distances T1 and T2, an odd zero 00 has module numbers T1=2 and T2=3, and an even zero E0 has module numbers T1=5 and T2=3, as shown in FIG. 2. Hence, the numerical value indicated by the bar code is discriminated, depending on the module numbers of the .delta.-distances T1 and T2.
In FIG. 2, the left column shows the odd zero 00 through an odd nine 09, the right column shows the even zero E0 through an even nine E9, each blank square indicates a module corresponding to a white bar and each square with hatching indicates a module corresponding to a black bar. The odd zero 00 through odd nine 09 correspond to cases where an odd number of modules, corresponding to the black bars, exist within one character length, and the even zero E0 through even nine E9 correspond to cases where an even number of modules, corresponding to the black bars, exist within one character length. In the case shown in FIG. 2, one character length includes seven modules.
The numerical value of the read bar code is discriminated, by using a demodulation table shown in FIG. 3, depending on the module numbers of the .delta.-distances T1 and T2.
As may be seen from FIGS.2 and 3, when the numerical value of the bar code is discriminated by the module numbers of the .delta.-distances T1 and T2, the odd one 01 and the odd seven 07 cannot be distinguished from each other because T1=3 and T2=4, that is, the .delta.-distances T1 and T2 are the same for both 01 and 07. Similarly, the even two E2 and the even eight E8 cannot be distinguished from each other because T1=3 and T2=3, that is, the .delta.-distances T1 and T2 are the same for both E2 and E8. For similar reasons, the odd two 02 and the odd eight 08 cannot be distinguished from each other, and the even one E1 and the even seven E7 cannot be distinguished from each other.
Accordingly, it is necessary to distinguish the above cases by obtaining the number of modules corresponding to the black bars. For example, in the case where T1=3 and T2=4, the value is 01 if the number of modules corresponding to the black bars within the .delta.-distance T1 is "1", and the value is 07 if the number of modules corresponding to the black bars within the .delta.-distance T1 is "2" Similarly, in the case where T1=3 and T2=3, the value is E2 if the number of modules corresponding to the black bars within the .delta.-distance T1 is "2", and the value is E8 if the number of modules corresponding to the black bars within the .delta.-distance T1 is "1".
As described above, the width of the black bar increases or decreases depending on the printing quality. Conventionally, in order to avoid the undesirable effects of the increased or decreased width of the black bar, the number of modules is calculated after correcting the width of the read black bar based on the width of the black bar included in the immediately preceding character which is already demodulated.
Next, a description will be given of an example of a conventional character demodulation method, by referring to FIGS. 4 and 5. FIG. 4 is a flow chart for explaining this conventional character demodulation method. For the sake of convenience, it will be assumed that a character of odd zero 00 is followed by a character of odd two 02 as shown in FIG. 5.
First, the numbers of modules of the .delta.-distances T1' and T2' shown in FIG. 5 are calculated from a character length C2. According to the standards such as the Universal Product Code (UPC) and the Japan Article Number (JAN), one character is formed by 7 modules. In this case, the length of one module can be obtained by dividing the character length Cn by 7. If the .delta.-distances T1' and T2' are respectively divided by the length of the module calculated in this manner, it is possible to obtain T1'=2 (modules) and T2'=3 (modules). This character is demodulated based on the demodulation table shown in FIG. 3, and it is found that this character is the odd zero 00 in this case. The number of modules corresponding to the black bars at the end i.e., in region B5 of this character 00 is "1", and this value "1" is stored in a register BRM (not shown) which will be described later.
Thereafter, the character demodulation process shown in FIG. 4 is carried out, as follows, to start demodulation of the next character.
First, a step S1 calculates the numbers of modules of the .delta.-distances T1 and T2. More particularly, a character length C1 is divided by 7 to obtain the length (C1/7) of one module. A number of modules of the .delta.-distance T1 and a number T2M of modules of the .delta.-distance T2 are calculated based on the following formulas, where n=1 for the character length C1. EQU T1M=INT[T1/(Cn/7)+0.5] EQU T2M=INT[T2/(Cn/7)+0.5]
In the above formulas, INT[X+0.5] is a process which is carried out to round the figures after the decimal point. Hence, the number T1M of modules is calculated as "4" for the .delta.-distance T1, and the number T2M of modules is calculated as "3" for the .delta.-distance T2.
A step S2 makes access to the demodulation table shown in FIG. 3 using the calculated numbers and T2M of modules of the .delta.-distances T1 and T2, so as to demodulate the character.
If the character is "1", "7", "2" or "8", the character demodulation cannot be completed solely by the access to the demodulation table. Hence, a step S3 decides whether or not the character is "1", "7", "2" or "8". If the character is "0", "3", "4", "5", "6" or "9" and the decision result in the step S3 is NO, a step S7 calculates a reference number of modules corresponding to the black bars, that is, the number of black bars within the .delta.-distance T1, and specifically in region B1 based on a known bar code code table. The calculated reference number BRM is stored in the register BRM, and the character demodulation process ends.
On the other hand, if the character is "1", "7", "2" or "8" and the decision result in the step S3 is YES, it is necessary to calculate the number of black bars within the .delta.-distance T1 and judge whether the character is "1", "7", "2" or "8". But in this case, it is necessary to carry out a process of correcting the width of the black bars in order to eliminate the undesirable effects of the increased or decreased width of the black bars. Hence, a difference between regions B1 and B5 shown in FIG. 5 is obtained, and a number .DELTA.M of modules of this difference is obtained based on the following formula in a step S4 (FIG. 4). In this case, .DELTA.M=1. EQU .DELTA.M=INT[(B1-B5)/(Cn/7)+0.5]
Then, a number B1M of modules within the region B1 is obtained based on the following formula in a step S5, that is, by adding to the number .DELTA.M the number BRM of modules corresponding to the black bars within the region B5 which was stored in the register BRM when obtaining the character length C2. In this case, BRM=1, and B1M=2. EQU B1M=BRM+.DELTA.M
The number B1M of modules within the region B1 is obtained in the above described manner, and a step S6 judges whether the character is "1", "7", "2" or "8" based on the number B1M. In this case, it is judged that the character is the odd two 02. Thereafter, the step S7 described above is carried out to store the calculated reference number of modules corresponding to the black bars into the register BRM for use in demodulating the next character, and the character demodulation process ends.
The conventional character demodulation process is effective for reducing the undesirable effects of the uniformly increased or decreased width of the black bars due to the poor printing quality or the like. However, since the operation process is carried out using the black bar within the adjacent character as a reference, there is a problem in that a read error occurs if the respective widths of the black bars undergo a non-uniform increase or decrease, such as when the label is curved.